Optimal. Leaf size=87 \[ \left (a^2 B-b^2 B-2 a b C\right ) x-\frac {\left (2 a b B+a^2 C-b^2 C\right ) \log (\cos (c+d x))}{d}+\frac {b (b B+a C) \tan (c+d x)}{d}+\frac {C (a+b \tan (c+d x))^2}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 87, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 38, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.105, Rules used = {3713, 3609,
3606, 3556} \begin {gather*} -\frac {\left (a^2 C+2 a b B-b^2 C\right ) \log (\cos (c+d x))}{d}+x \left (a^2 B-2 a b C-b^2 B\right )+\frac {b (a C+b B) \tan (c+d x)}{d}+\frac {C (a+b \tan (c+d x))^2}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3606
Rule 3609
Rule 3713
Rubi steps
\begin {align*} \int \cot (c+d x) (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx &=\int (a+b \tan (c+d x))^2 (B+C \tan (c+d x)) \, dx\\ &=\frac {C (a+b \tan (c+d x))^2}{2 d}+\int (a+b \tan (c+d x)) (a B-b C+(b B+a C) \tan (c+d x)) \, dx\\ &=\left (a^2 B-b^2 B-2 a b C\right ) x+\frac {b (b B+a C) \tan (c+d x)}{d}+\frac {C (a+b \tan (c+d x))^2}{2 d}+\left (2 a b B+a^2 C-b^2 C\right ) \int \tan (c+d x) \, dx\\ &=\left (a^2 B-b^2 B-2 a b C\right ) x-\frac {\left (2 a b B+a^2 C-b^2 C\right ) \log (\cos (c+d x))}{d}+\frac {b (b B+a C) \tan (c+d x)}{d}+\frac {C (a+b \tan (c+d x))^2}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.32, size = 96, normalized size = 1.10 \begin {gather*} \frac {(a+i b)^2 (-i B+C) \log (i-\tan (c+d x))+(a-i b)^2 (i B+C) \log (i+\tan (c+d x))+2 b (b B+2 a C) \tan (c+d x)+b^2 C \tan ^2(c+d x)}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.31, size = 102, normalized size = 1.17
method | result | size |
norman | \(\left (a^{2} B -b^{2} B -2 C a b \right ) x +\frac {b \left (B b +2 C a \right ) \tan \left (d x +c \right )}{d}+\frac {b^{2} C \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {\left (2 B a b +C \,a^{2}-b^{2} C \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) | \(90\) |
derivativedivides | \(\frac {b^{2} B \left (\tan \left (d x +c \right )-d x -c \right )+b^{2} C \left (\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}+\ln \left (\cos \left (d x +c \right )\right )\right )-2 B a b \ln \left (\cos \left (d x +c \right )\right )+2 C a b \left (\tan \left (d x +c \right )-d x -c \right )+a^{2} B \left (d x +c \right )-C \,a^{2} \ln \left (\cos \left (d x +c \right )\right )}{d}\) | \(102\) |
default | \(\frac {b^{2} B \left (\tan \left (d x +c \right )-d x -c \right )+b^{2} C \left (\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}+\ln \left (\cos \left (d x +c \right )\right )\right )-2 B a b \ln \left (\cos \left (d x +c \right )\right )+2 C a b \left (\tan \left (d x +c \right )-d x -c \right )+a^{2} B \left (d x +c \right )-C \,a^{2} \ln \left (\cos \left (d x +c \right )\right )}{d}\) | \(102\) |
risch | \(B \,a^{2} x -B \,b^{2} x -2 C a b x +\frac {2 i b \left (-i C b \,{\mathrm e}^{2 i \left (d x +c \right )}+B b \,{\mathrm e}^{2 i \left (d x +c \right )}+2 C a \,{\mathrm e}^{2 i \left (d x +c \right )}+B b +2 C a \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {2 i C \,b^{2} c}{d}-i C \,b^{2} x +2 i B a b x +\frac {2 i C \,a^{2} c}{d}+\frac {4 i B a b c}{d}+i C \,a^{2} x -\frac {2 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B a b}{d}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) C \,a^{2}}{d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) b^{2} C}{d}\) | \(204\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 91, normalized size = 1.05 \begin {gather*} \frac {C b^{2} \tan \left (d x + c\right )^{2} + 2 \, {\left (B a^{2} - 2 \, C a b - B b^{2}\right )} {\left (d x + c\right )} + {\left (C a^{2} + 2 \, B a b - C b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (2 \, C a b + B b^{2}\right )} \tan \left (d x + c\right )}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.42, size = 91, normalized size = 1.05 \begin {gather*} \frac {C b^{2} \tan \left (d x + c\right )^{2} + 2 \, {\left (B a^{2} - 2 \, C a b - B b^{2}\right )} d x - {\left (C a^{2} + 2 \, B a b - C b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 2 \, {\left (2 \, C a b + B b^{2}\right )} \tan \left (d x + c\right )}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.56, size = 151, normalized size = 1.74 \begin {gather*} \begin {cases} B a^{2} x + \frac {B a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - B b^{2} x + \frac {B b^{2} \tan {\left (c + d x \right )}}{d} + \frac {C a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 2 C a b x + \frac {2 C a b \tan {\left (c + d x \right )}}{d} - \frac {C b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {C b^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right )^{2} \left (B \tan {\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) \cot {\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 1.15, size = 95, normalized size = 1.09 \begin {gather*} \frac {C b^{2} \tan \left (d x + c\right )^{2} + 4 \, C a b \tan \left (d x + c\right ) + 2 \, B b^{2} \tan \left (d x + c\right ) + 2 \, {\left (B a^{2} - 2 \, C a b - B b^{2}\right )} {\left (d x + c\right )} + {\left (C a^{2} + 2 \, B a b - C b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.85, size = 91, normalized size = 1.05 \begin {gather*} \frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {C\,a^2}{2}+B\,a\,b-\frac {C\,b^2}{2}\right )}{d}-x\,\left (-B\,a^2+2\,C\,a\,b+B\,b^2\right )+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (B\,b^2+2\,C\,a\,b\right )}{d}+\frac {C\,b^2\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________